package sctu.edu.java.year2016.team07.wenjia.day20160522.chapter4_3;

/**
 * Created by 001 on 2016/5/22.
 * 用while循环语句计算1+1/2！+1/3！+......1/20!之和
 */
public class dayinhezhi {
    public static void main(String[]args){
        int i=1,j=1;
        float n=1;
        float sum=0f;
        while(i<=20){
            while(j<=i){
                n=j*n;j++;
            }
            i++;
            sum=sum+1/n;
        }
        System.out.println("1+1/2!+1/3!+....1/20!的和是："+sum);
    }
}
